﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using WmsApp.StaticData;
using WmsApp.WindowControl;

namespace WmsApp.WmsService
{
    public partial class OutStoreBill : IWcfState
    {
        public static OutStoreBill CreateOutStoreBill()
        {
            OutStoreBill r = new OutStoreBill
            {
                BillID = Constant.NewOutBillId,
                ExtVarChar1 = "001",//出库类型
                //ExtVarChar2 = "",
                //ExtVarChar3 = "",
                //ExtVarChar4 = "",
                ExtNumeric1 = 0,
                ExtNumeric2 = 0,
                ExtNumeric3 = 0,
                ExtNumeric4 = 0,
                BillState = Constant.BillStateDraft,
                BillDate = DateTime.Now.Date,
                //OutBillDate = DateTime.Now,
                ProviderName = "",
                ProviderCode = "",
                WcfEntityState = System.Data.EntityState.Added
            };
            r.BindPropertyChanged();
            return r;
        }

        public string BillStateDesc
        {
            get
            {
                if (BillState == Constant.BillStateDraft)
                    return "草稿";
                else if (BillState == Constant.BillStateAffirm)
                    return "确认";
                else if (BillState == Constant.BillStateDelete)
                    return "作废";
                return "未知";
            }
        }

        /// <summary>
        /// 出库类型描述
        /// </summary>
        public string OutStoreTypeDesc
        {
            get
            {
                return BillTypeTranslate.GetOutStoreTypeDescByCode(ExtVarChar1);
            }
        }

        public void BindPropertyChanged()
        {
            this.PropertyChanged += WmsApp.EntityControl.PropertyChangedHandler.EntityObjectPropertyChanged;
        }
    }
}
